"""
客户关怀页面类
"""
from ..base_page import BasePage
from selenium.webdriver.common.by import By


class AddCustomercarePage(BasePage):
    #数据
    url="/crm/index.php?m=customer&a=cares"
    #定位器
    select_gh_locator = (By.CSS_SELECTOR, "body > div.container > div.row > div:nth-child(1) > div > a")
    select_ghdj_locator = (By.CSS_SELECTOR, "#customer_name")
    ok_locator = (By.CSS_SELECTOR,"body > div:nth-child(9) > div.ui-dialog-buttonpane.ui-widget-content.ui-helper-clearfix > div > button:nth-child(1)")  # ok按钮
    ghzt_locator = (By.CSS_SELECTOR, "#name")  # 关怀主题
    ghrq_locator = (By.CSS_SELECTOR, "#care_time")
    save_locator = (By.NAME, "submit")
    tips_customercare_locator = (By.CSS_SELECTOR, "body > div.container > div.alert.alert-success")

    #方法
    def select_gh(self):
        self.click(self.select_gh_locator)
    def select_ghdj(self):
        self.click(self.select_ghdj_locator)
    def btn_ok(self):
        self.click(self.ok_locator)
    def ghzt(self,title):
        self.send_keys(self.ghzt_locator,title)
    def ghrq(self,date):
        self.send_keys(self.ghrq_locator,date)
    def save(self):
        self.click(self.save_locator)
    def tips_customercare(self):
        return self.find_element(self.tips_customercare_locator).text